package com.example.mediator;

import com.example.mediator.bo.User;

/**
 * 中介者模式
 */
public class Test {
    public static void main(String[] args) {
        Mediator roomMediatorImpi = new ChatRoomMediatorImpi("《吊毛聚一堆》");

        User user1 = new User("李卓彦", roomMediatorImpi);
        User user2 = new User("伍贺贤", roomMediatorImpi);
        User user3 = new User("林元洛", roomMediatorImpi);
        User user4 = new User("林俊贤", roomMediatorImpi);

        roomMediatorImpi.addUser(user1);
        roomMediatorImpi.addUser(user2);
        roomMediatorImpi.addUser(user3);
        roomMediatorImpi.addUser(user4);

        System.out.println(roomMediatorImpi.getRoomName());

        user1.send("全体目光向我看齐，我是个煞笔");
        user1.sendPrivate("伍贺贤", "我刚才帅气吧");

        roomMediatorImpi.removeUser(user1);

        user3.send("李卓怎么退群了？");
    }
}
